package com.rp.fallbacks;

import com.rp.api.user.UserControllerApi;
import com.rp.bo.UpdateUserInfoBO;
import com.rp.news.common.Result;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import javax.validation.Valid;

@Component
public class UserControllerFactoryFallback implements FallbackFactory<UserControllerApi> {
    @Override
    public UserControllerApi create(Throwable throwable) {
        return  new UserControllerApi() {

            @Override
            public Result test1() {
                return Result.errorMsg("客户端熔断服务降级");
            }

            @Override
            public Result getUserInfo(String userId) {
                return Result.errorMsg("客户端熔断服务降级");
            }

            @Override
            public Result getAccountInfo(String userId) {
                return Result.errorMsg("客户端熔断服务降级");
            }

            @Override
            public Result updateUserInfo(@Valid UpdateUserInfoBO updateUserInfoBO) {
                return Result.errorMsg("客户端熔断服务降级");
            }

            @Override
            public Result queryByIds(String userIds) {
                return Result.errorMsg("客户端熔断服务降级");
            }
        };
    }
}
